package com.shopping.serviceImpl;

import com.shopping.dao.BusinessDao;
import com.shopping.pojo.Business;
import com.shopping.pojo.vo.BusinessInfo;
import com.shopping.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusinessServiceImpl implements BusinessService {
    @Autowired
    private BusinessDao businessDao;

    @Override
    public List<BusinessInfo> selectBusinessByQuery(String businessName, String userName, int start, int limit) {
        return businessDao.selectBusinessByQuery(businessName,userName,start,limit);
    }

    @Override
    public int getBusinessNum(String businessName, String userName) {
        return businessDao.getBusinessNum(businessName,userName);
    }

    @Override
    public boolean checkBusinessIdAndPassword(String businessId, String password) {
        return businessDao.checkBusinessIdAndPassword(businessId,password)>0;
    }

    @Override
    public boolean updateBusinessInfo(Business business) {
        return businessDao.updateBusinessInfo(business)>0;
    }

    @Override
    public String getBusinessName(String businessId) {
        return businessDao.getBusinessName(businessId);
    }

    @Override
    public int getId(String businessId) {
        return businessDao.getId(businessId);
    }

    @Override
    public boolean checkBusinessName(String businessName) {
        return businessDao.checkBusinessName(businessName)>0;
    }

    @Override
    public BusinessInfo selectBusinessInfo(String businessId) {
        return businessDao.selectBusinessInfo(businessId);
    }

    @Override
    public Business selectBusiness(String businessId) {
        return businessDao.selectBusiness(businessId);
    }

    @Override
    public boolean businessCancellation(String businessId) {
        return businessDao.businessCancellation(businessId)>0;
    }

    @Override
    public boolean checkBusinessOwner(Integer userId) {
        return businessDao.checkBusinessOwner(userId)>0;
    }

    @Override
    public boolean updateBusinessTransfer(Integer userId, String businessId) {
        return businessDao.updateBusinessTransfer(userId,businessId)>0;
    }

    @Override
    public boolean updateBusinessPass(String businessId, String password) {
        return businessDao.updateBusinessPass(businessId,password)>0;
    }

    @Override
    public List<BusinessInfo> selectBusinessByBusinessName(String businessName) {
        return businessDao.selectBusinessByBusinessName(businessName);
    }

    @Override
    public boolean deleteBusiness(Integer id) {
        return businessDao.deleteBusiness(id)>0;
    }

    @Override
    public boolean updateBusinessStatusSuccess(Integer id) {
        return businessDao.updateBusinessStatusSuccess(id)>0;
    }

    @Override
    public boolean updateBusinessJoinBlackList(Integer id) {
        return businessDao.updateBusinessJoinBlackList(id)>0;
    }

    @Override
    public boolean updateBusinessRemoveBlackList(Integer id) {
        return businessDao.updateBusinessRemoveBlackList(id)>0;
    }

    @Override
    public boolean checkBusinessInfo(String businessId, String name, String businessPhone) {
        return businessDao.checkBusinessInfo(businessId,name,businessPhone)>0;
    }

    @Override
    public boolean insertBusiness(Business business) {
        return businessDao.insertBusiness(business)>0;
    }

    @Override
    public boolean updateBusinessImage(String businessId, String businessImage) {
        return businessDao.updateBusinessImage(businessId,businessImage)>0;
    }
}
